﻿using System;
using System.Linq;
using System.ComponentModel.DataAnnotations;

namespace TaoNiuOA.Models
{
    /// <summary>
    /// 考勤策略
    /// </summary>
    public class CheckingStrategy
    {
        [Key]
        public int CheckingStrategyID { get; set; }

        [Display(Name = "类型")]
        public int ApplyTypeID { get; set; }

        [Display(Name = "绩效")]
        [Required(ErrorMessage = "请输入数字,如要减绩效请用'-',如:-1")]
        public double Point { get; set; }

        //获取类型
        public ApplyType GetApplyType()
        {
            var db = new TaoNiuOA.Models.DbEntity();
            var at = db.ApplyTypes.SingleOrDefault(n => n.ApplyTypeID == this.ApplyTypeID);
            if (at == null)
                at = new ApplyType();
            return at;
        }
    }
}
